package utils;

public class GeoUtils {

    public static boolean isCollinear(Point3D p0, Point3D p1, Point3D p2) {
	return ((p0.distance(p1) + p1.distance(p2) == p0.distance(p2)) || (p1.distance(p2) + p2.distance(p0) == p1.distance(p0)) || (p2.distance(p0) + p0.distance(p1) == p2
		.distance(p1)));
    }

    public static boolean isSameSide(Point3D testPoint, Point3D insidePoint, Point3D a, Point3D b) {
	Vector line = new Vector(a, b);

	Vector vTest = line.crossProduct(new Vector(a, testPoint));
	Vector vKnown = line.crossProduct(new Vector(a, insidePoint));

	return (vTest.dotProduct(vKnown) >= 0);
    }

}
